package com.aegis.api.auth.manage;

import com.aegis.api.auth.context.FeignContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.util.StringUtils;

/**
 * @Author wuweixin
 *
 * @Version 1.0
 * @Descritube
 */
public class FeignInterceptor implements RequestInterceptor {


    @Override
    public void apply(RequestTemplate requestTemplate) {
        FeignContext feignContext = FeignManager.getFeignContext();
        if (StringUtils.hasText(feignContext.getUrl())) {
            requestTemplate.target(feignContext.getUrl());
        }
    }
}
